package 微软笔试.task3;

public class Solution {
    public int solution(int[] A, int M) {
        int res = 0;
        int n = A.length;
        for(int i = 0;i<n;i++){
            int sum = 0;
            for(int j = i;j<n;j++){
                int val = Math.abs(A[j]-A[i]);
                if(val%M==0){
                    sum++;
                }
            }
            res = Math.max(res,sum);
        }
        return res;
    }
}
